home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group92c.txt / 000107_icon-group-sender _Tue Dec 15 10:44:24 1992.msg < prev    next >
Internet Message Format  |  1993-01-04  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Tue, 15 Dec 1992 05:28:56 MST
  2. Via: uk.ac.edinburgh.festival; Tue, 15 Dec 1992 10:44:33 +0000
  3. Date: 15 Dec 92 10:44:24 GMT
  4. From: R J Hare <ercn72@festival.ed.ac.uk>
  5. Subject: Problem with XIcon syntax.
  6. To: icon-group@cs.arizona.edu
  7. Message-Id: <9212151044.aa28611@uk.ac.ed.festival>
  8. Status: R
  9. Errors-To: icon-group-errors@cs.arizona.edu
  10.  
  11.  
  12. I have a minor problem with XIcon syntax - can anyone help?
  13.  
  14. I wish to execute a loop, the culmination of which is the drawing of a single
  15. point in the XWindow. I wish to be able to terminate execution of the loop and
  16. move to the next phase of the program at any point (ie: with the picture
  17. incomplete) by pressing a button on my mouse. I reackon the code should look
  18. something like this:
  19.  
  20. procedure main()
  21.   .
  22. every i:=1 to n
  23. do {if XEvent(window)==&lpress then break # force a break if lb is pressed
  24.       .
  25.     loop code culminating in
  26.     XDrawPoint(window,x,y)}}
  27.   .
  28. remainder of code
  29.   .
  30. end
  31.  
  32. This seems to get in some sort of hung-up situation - I see no points being
  33. drawn in my window and pressing the left mouse button doesn't seem to exit
  34. from the loop either.
  35.  
  36. The following code works, but doesn't seem so intuitive:
  37.  
  38. every i:=1 to n
  39. do {if (events:=XPending(window) & *events > 0)      # force a
  40.     then if XEvents(window)==&lpress                 # break if left
  41.     then break                                       # button pressed
  42.       .
  43.     loop code culminating in
  44.     XDrawPoint(window,x,y)}}
  45.   .
  46. remainder of code
  47.   .
  48. end
  49.  
  50. Should the first form of the code work, or what?
  51.  
  52. Thanks.
  53.  
  54. Roger Hare.
  55.